package com.lyncs.ods.modules.goods.service;

import com.lyncs.ods.common.api.CommonPage;
import com.lyncs.ods.common.api.Option;
import com.lyncs.ods.modules.goods.model.SkuDetailInfo;
import com.lyncs.ods.req.ListSkuReq;
import com.lyncs.ods.req.SaveSkuReq;
import com.lyncs.ods.resp.SpuAttrInfoResp;
import com.lyncs.ods.resp.SpuInfoResp;

import java.math.BigDecimal;
import java.util.List;

/**
 * @author alex
 * @date 2022/2/5 21:28
 * @description
 */
public interface GoodService {

    /**
     * get all available spu
     *
     * @param keyword  keyword
     * @param page     page
     * @param pageSize pageSize
     * @return spu info
     */
    CommonPage<SpuInfoResp> listSpu(String keyword, Integer page, Integer pageSize);

    /**
     * get spu attr info by id
     *
     * @param spuId spu id
     * @return attr infos
     */
    List<SpuAttrInfoResp> getSpuAttrInfos(Long spuId);

    /**
     * save sku
     *
     * @param req request info
     * @return sku id
     */
    Long saveSku(SaveSkuReq req);

    /**
     * get sku info by spu id
     *
     * @param req request info
     * @return sku infos
     */
    CommonPage<SkuDetailInfo> listSkuInfo(ListSkuReq req);

    /**
     * 根据指定spuId和属性名称查询候选项
     *
     * @param spuId spuId
     * @param attrId  属性ID
     * @return options
     */
    List<String> listSpuOptions(Long spuId,  Long attrId);

    /**
     * 删除sku
     *
     * @param skuId skuId
     */
    void deleteSku(Long skuId);

    List<SkuDetailInfo> getSkuDetailInfos(List<Long> skuIds);

    /**
     * 刷新 sku 单价
     *
     * @param skuIds   skuIds
     * @param currency currency
     * @return resp
     */
    List<Option<Long, BigDecimal>> refreshSkuAmount(String skuIds, String currency);

    /**
     * get sku detail
     *
     * @param skuId skuId
     * @return sku detail
     */
    SkuDetailInfo getSkuDetail(Long skuId, String currency);
}
